package me.tonywang.quartz.entity;

import com.baomidou.mybatisplus.activerecord.Model;
import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableName;

import java.io.Serializable;
import java.util.Date;

/**
 * * <p>状态变更图</p>
 *  * <li>DELETED (注销)  --->>> SCHEDULED(激活) --->>>EXECUTING (运行时)</li>
 *  * <li>PAUSED (暂停) --->>>RESUMED (恢复）  --->>>EXECUTING (运行时)</li>
 * <p>
 * 定时任务信息表
 * </p>
 *
 * @author tony.wang
 * @since 2018-05-21
 */
@TableName("t_qrtz_crontask")
public class Crontask extends Model<Crontask> {

    public enum CrontaskState {EXECUTING, ADDED, DELETED, PAUSED, RESUMED, SCHEDULED, UNSCHEDULED, COMPLETE, ERROR, BLOCKED, NONE}


    private static final long serialVersionUID = 1L;

    /**
     * 编号
     */
	private String id;
    /**
     * 任务名 quartz 中的 triggerName jobName 两者保持和name一致
     */
	@TableField("job_name")
	private String jobName;
    /**
     * 任务分组 分组任务
     */
	@TableField("job_group")
	private String jobGroup;
    /**
     * springBeanName spring容器中提供的bean
     */
	@TableField("target_bean_name")
	private String targetBeanName;
    /**
     * targetMethod spring容器中提供的bean提供的方法
     */
	@TableField("target_method")
	private String targetMethod;
    /**
     * 请求字符串 推荐使用JSON字符串
     */
	@TableField("request_obj")
	private String requestObj;
    /**
     * cron表达式 cron表达式
     */
	@TableField("cron_expression")
	private String cronExpression;
    /**
     * 手动执行的任务 默认是0（试验字段）
     */
	private String durability;
    /**
     * 是否并发 默认是1（试验字段）
     */
	private String concurrent;
    /**
     * 优先级
     */
	private Integer priority;
    /**
     * misfire策略
     */
	@TableField("misfire_policy")
	private Integer misfirePolicy;
    /**
     * 失效转移 默认是0（试验字段）
     */
	@TableField("requests_recovery")
	private String requestsRecovery;
    /**
     * JOB描述 描述
     */
	private String description;
    /**
     * 创建时间 创建时间
     */
	@TableField("create_time")
	private Date createTime;
    /**
     * 创建人
     */
	private String creator;
    /**
     * 上次触发时间
     */
	@TableField("prev_fire_time")
	private Date prevFireTime;
    /**
     * 计划执行时间 计划执行时间
     */
	@TableField("sched_fire_time")
	private Date schedFireTime;
    /**
     * 下次触发时间 下次触发时间
     */
	@TableField("next_fire_time")
	private Date nextFireTime;
    /**
     * 开始时间 开始时间
     */
	@TableField("start_time")
	private Date startTime;
    /**
     * 实际执行时间 实际执行时间
     */
	@TableField("fire_time")
	private Date fireTime;
    /**
     * 当前所处节点 当前所处节点
     */
	@TableField("sched_inst")
	private String schedInst;
    /**
     * 当前所属集群 所属集群
     */
	@TableField("sched_name")
	private String schedName;
    /**
     * job状态 job状态
     */
	@TableField("job_state")
	private String jobState;
    /**
     * 上次完成时间 上次完成时间
     */
	@TableField("last_finish_time")
	private Date lastFinishTime;


	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getJobName() {
		return jobName;
	}

	public void setJobName(String jobName) {
		this.jobName = jobName;
	}

	public String getJobGroup() {
		return jobGroup;
	}

	public void setJobGroup(String jobGroup) {
		this.jobGroup = jobGroup;
	}

	public String getTargetBeanName() {
		return targetBeanName;
	}

	public void setTargetBeanName(String targetBeanName) {
		this.targetBeanName = targetBeanName;
	}

	public String getTargetMethod() {
		return targetMethod;
	}

	public void setTargetMethod(String targetMethod) {
		this.targetMethod = targetMethod;
	}

	public String getRequestObj() {
		return requestObj;
	}

	public void setRequestObj(String requestObj) {
		this.requestObj = requestObj;
	}

	public String getCronExpression() {
		return cronExpression;
	}

	public void setCronExpression(String cronExpression) {
		this.cronExpression = cronExpression;
	}

	public String getDurability() {
		return durability;
	}

	public void setDurability(String durability) {
		this.durability = durability;
	}

	public String getConcurrent() {
		return concurrent;
	}

	public void setConcurrent(String concurrent) {
		this.concurrent = concurrent;
	}

	public Integer getPriority() {
		return priority;
	}

	public void setPriority(Integer priority) {
		this.priority = priority;
	}

	public Integer getMisfirePolicy() {
		return misfirePolicy;
	}

	public void setMisfirePolicy(Integer misfirePolicy) {
		this.misfirePolicy = misfirePolicy;
	}

	public String getRequestsRecovery() {
		return requestsRecovery;
	}

	public void setRequestsRecovery(String requestsRecovery) {
		this.requestsRecovery = requestsRecovery;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public Date getCreateTime() {
		return createTime;
	}

	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}

	public String getCreator() {
		return creator;
	}

	public void setCreator(String creator) {
		this.creator = creator;
	}

	public Date getPrevFireTime() {
		return prevFireTime;
	}

	public void setPrevFireTime(Date prevFireTime) {
		this.prevFireTime = prevFireTime;
	}

	public Date getSchedFireTime() {
		return schedFireTime;
	}

	public void setSchedFireTime(Date schedFireTime) {
		this.schedFireTime = schedFireTime;
	}

	public Date getNextFireTime() {
		return nextFireTime;
	}

	public void setNextFireTime(Date nextFireTime) {
		this.nextFireTime = nextFireTime;
	}

	public Date getStartTime() {
		return startTime;
	}

	public void setStartTime(Date startTime) {
		this.startTime = startTime;
	}

	public Date getFireTime() {
		return fireTime;
	}

	public void setFireTime(Date fireTime) {
		this.fireTime = fireTime;
	}

	public String getSchedInst() {
		return schedInst;
	}

	public void setSchedInst(String schedInst) {
		this.schedInst = schedInst;
	}

	public String getSchedName() {
		return schedName;
	}

	public void setSchedName(String schedName) {
		this.schedName = schedName;
	}

	public String getJobState() {
		return jobState;
	}

	public void setJobState(String jobState) {
		this.jobState = jobState;
	}

	public Date getLastFinishTime() {
		return lastFinishTime;
	}

	public void setLastFinishTime(Date lastFinishTime) {
		this.lastFinishTime = lastFinishTime;
	}

	@Override
	protected Serializable pkVal() {
		return this.id;
	}

}
